package com.itheima.app.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author 请不要叫我高司令
 * @Date 2022/3/14 22:26
 * @Version 1.0
 */

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private TokenInterceptor tokenInterceptor;

    //注册拦截器


    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(tokenInterceptor)
        .addPathPatterns("/**")
        // 放行登录、发短信地址
        .excludePathPatterns("/user/loginVerification","/user/login");
    }
}
